package test.myorm.core;

import java.util.HashMap;
import java.util.Map;

public class ResultMap extends BaseMapping {
	private Class<?> clazz;
	private boolean isBase;
	private Map<String, String> columnMapping = new HashMap<>();//column=>property
	public ResultMap() {
		super();
		setClazz(HashMap.class);
	}
	public ResultMap(Class<?> clazz) {
		super();
		setClazz(clazz);
	}
	public ResultMap(Class<?> clazz, Map<String, String> columnMapping) {
		super();
		this.clazz = clazz;
		this.columnMapping = columnMapping;
	}
	public Class<?> getClazz() {
		return clazz;
	}
	public void setClazz(Class<?> clazz) {
		this.clazz = clazz;
		if(baseClasses.contains(clazz)) {
			this.isBase = true;
		}
	}
	public Map<String, String> getColumnMapping() {
		return columnMapping;
	}
	public void setColumnMapping(Map<String, String> columnMapping) {
		this.columnMapping = columnMapping;
	}
	public void addColumnMapping(String column, String property) {
		this.columnMapping.put(column, property);
	}
	public boolean isBase() {
		return isBase;
	}
	@Override
	public String toString() {
		return "ResultMap [clazz=" + clazz + ", columnMapping=" + columnMapping + "]";
	}
}
